import { SET_AUTHENTICATED, SET_USER } from "./mutation-type";

export default {
  //是否授权
  [SET_AUTHENTICATED](state, { isAuthenticated }) {
    if (isAuthenticated) {
      state.isAuthenticated = isAuthenticated;
    } else {
      state.isAuthenticated = false;
    }
  },
  [SET_USER](state, { user }) {
    if (user) {
      state.user = user;
    } else {
      state.user = {};
    }
  },
  [SET_AUTHENTICATED](state) {
    state.isAuthenticated = false; //退出登录
  },
  setactivePath(state, index) {
    state.activePath = index;
  },
  saveSearchs(state, search) {
    state.searchs = search
  },
  savePager(state, pager) {
    state.pager = pager
  },
  copyTimeDate(state, data) {
    state.timeData = data
  },
  // setIsmOrpc(state, data) {
  //   state.ismOrpc = data
  // },
  setIsropc(state, ismOrpc) {
    state.ismOrpc = ismOrpc
  },
  changeNewMsg(state, num){
    console.log('state.newMsg ', state.newMsg ,num)
    let total = num ===0 ? 0 :state.newMsg + num 
    state.newMsg = total <=0 ? 0 : total
  },
 
};